<?php

use common\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
//use yii\bootstrap\Modal ;
//use yii\helpers\Url ;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $searchModel mdm\admin\models\searchs\Assignment */
/* @var $usernameField string */
/* @var $extraColumns string[] */

$this->title = '管理员';
$this->params['breadcrumbs'][] = $this->title;

$columns = [
    ['class' => 'yii\grid\SerialColumn'],
    $usernameField,
];
if (!empty($extraColumns)) {
    $columns = array_merge($columns, $extraColumns);
}
$columns[] = [
    'class' => 'yii\grid\ActionColumn',
    'template' => '{view}'
];
?>
<style>
.modal-dialog{
    z-index: 10051;
    margin-top: 80px;
}


</style>
<div class="assignment-index">

    <p>
        <?= Html::create(['create'], '管理员', [
            'data-toggle' => 'modal',
            'data-target' => '#ajaxModal',
            'class' => 'btn btn-success',
        ]); ?>

    </p>





    <?php Pjax::begin(); ?>
    <?=
    GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'summary' => "第{begin} - {end}条   共{totalCount}条数据",
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            [
                'attribute' => 'username',
                'label' => '管理员',
            ],

            ['class' => 'yii\grid\ActionColumn',
                'header' => '操作',
                'template' => '{view}',
                'buttons' => [
                    'view' => function ($url,$model,$key)   { return Html::a('分配角色', [$url], ['title' => '查看','class'=>"btn btn-primary btn-sm"]); },
                ],
            ],
        ]

    ]);
    ?>
    <?php Pjax::end(); ?>

</div>
